package cn.stylefeng.guns.generator.engine.config;


import cn.hutool.core.util.StrUtil;
import lombok.Data;

/**
 * 全局配置
 *
 * @author wanjian
 */
@Data
public class ContextConfig {
    private String templatePrefixPath = "gunsTemplate/advanced";
    private String projectPath;//模板输出的项目目录
    private String bizChName;   //业务名称
    private String bizEnName;   //业务英文名称
    private String bizEnBigName;//业务英文名称(大写)
    private String moduleName;  //模块名称

    private String proPackage = "cn.stylefeng.guns";
    private String coreBasePackage = proPackage+".core";
    private String modelPackageName;        //model的包名
    private String modelMapperPackageName;    //model的dao
    private String entityName;              //实体的名称
    private String outputDir;

    public ContextConfig(String projectPath,String bizEnName,String moduleName) {
        this.projectPath = projectPath;
        setBizEnName(bizEnName);
        if (entityName == null) {
            entityName = bizEnBigName;
        }
        this.moduleName = moduleName;
        modelPackageName = proPackage + "." + "modular."+moduleName;
        modelMapperPackageName = modelPackageName+".dao";
    }


    public void setBizEnName(String bizEnName) {
        this.bizEnName = bizEnName;
        this.bizEnBigName = StrUtil.upperFirst(this.bizEnName);
    }

    public String getServicePackage(){
        return getProPackage() + ".modular." + getModuleName() + ".service";
    }
    public String getEntityPackage(){
        return getProPackage() + ".modular."+getModuleName()+".model";
    }
    public String getMapperPackage(){
        return getProPackage() + ".modular."+getModuleName()+".dao";
    }
}
